package cn.cqie.attendance.manager.controller;

import cn.cqie.attendance.common.util.Page;
import cn.cqie.attendance.common.util.PageBean;
import cn.cqie.attendance.manager.pojo.*;
import cn.cqie.attendance.manager.service.AdminScoreService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author king james
 * @create 2021-07-07-{TIME}
 */
@RestController
@Api(tags = "管理员端-综合打分记录模块")
@RequestMapping("/admin/score")
public class AdminScoreController {
    @Autowired
    private AdminScoreService adminScoreService;

    /**
     * 查询所有学生综合得分
     * @param courseName 课程名
     * @param groupName 小组名
     * @param pageSize 每一页数量
     * @param pageNum 当前页数量
     * @return
     */
    @GetMapping("/queryAllStudentScoreInfo")
    @ApiOperation("查询所有学生综合得分")
    public PageBean<AdminStudentScore> queryAllStudentScoreInfo(String courseName, String groupName, Integer pageSize, Integer pageNum){
        return adminScoreService.queryAllStudentScoreInfo(courseName,groupName,pageSize,pageNum);
    }

    /**
     * 根据学生id、课程id查询该学生综合得分详情
     * @param stuId 学号
     * @return
     */
    @GetMapping("/queryStudentScoreById")
    @ApiOperation("根据学生id课程id查询该学生综合得分详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stuId",value ="学生id" ,required =true),
            @ApiImplicitParam(name = "courseId",value = "课程id",required = true
            )
    })
    public Page<AdminStudentScore> queryStudentScoreById(Integer stuId,Integer courseId){
       return adminScoreService.queryStudentScoreById(stuId,courseId);
    }

    /**
     * 根据学生id查询该学生所有作业完成情况
     * @param stuId 学生id
     * @param courseId 课程id
     * @param pageSize 每页数量
     * @param pageNum 当前页
     * @return
     */
    @GetMapping("/queryAllStudentHomeworkInfoById")
    @ApiOperation("根据学生id、课程id查询该课程某个学生所有作业完成情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "stuId",value ="学生id" ,required =true),
            @ApiImplicitParam(name = "courseId",value = "课程id",required = true),
            @ApiImplicitParam(name = "pageSize", value = "每一页的数量(10)", required = false),
            @ApiImplicitParam(name = "pageNum", value = "当前页(1)", required = false)
    })
    public PageBean<AdminStudentHomework> queryStudentHomeWorkById(Integer stuId,Integer courseId,Integer pageSize, Integer pageNum){
        return adminScoreService.queryAllStudentHomeworkInfoById(stuId,courseId,pageSize,pageNum);
    }

    /**
     * 通过id查询学生某次作业的完成详情
     * @param homeworkId 作业id
     * @return
     */
    @ApiOperation("通过id查询学生某次作业的完成详情")
    @GetMapping("/queryStudentHomeworkById")
    @ApiImplicitParam(name = "homeworkId",value = "作业id",required = true)
    public Page<AdminStudentHomework> queryStudentHomeworkInfoById(Integer homeworkId){
        return adminScoreService.queryStudentHomeworkById(homeworkId);
    }

    /**
     *
     * 查询所有小组综合得分
     * @param courseName 课程名
     * @param groupName 小组名
     * @param pageSize 每页数量
     * @param pageNum 当前页数
     * @return
     */
    @GetMapping("/queryAllGroupScoreInfo")
    @ApiOperation("查询所有小组综合得分")
    public PageBean<AdminGroupScore> queryAllGroupScoreInfo(String courseName, String groupName, Integer pageSize, Integer pageNum){
        return adminScoreService.queryAllGroupScoreInfo(courseName,groupName,pageSize,pageNum);
    }
    /**
     * 根据小组id课程id查询该小组得综合得分详情
     * @param groupId 小组id
     * @param groupCourseId 课程id
     * @return
     */
    @GetMapping("/queryGroupScoreById")
    @ApiOperation("根据小组id课程id查询该小组得综合得分详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "groupId",value ="学生id" ,required =true),
            @ApiImplicitParam(name = "groupCourseId",value = "课程id",required = true
            )
    })
    public Page<AdminGroupScore> queryGroupScoreById(Integer groupId ,Integer groupCourseId){
        return adminScoreService.queryGroupScoreById(groupId,groupCourseId);
    }

    /**
     * 根据小组id查询该小组所有作业完成情况
     * @param groupId 小组id
     * @param groupCourseId 课程id
     * @param pageSize 每一页数量
     * @param pageNum 当前页
     * @return
     */
    @GetMapping("/queryAllGroupHomeworkInfoById")
    @ApiOperation("根据小组id、课程id查询该小组这个课程所有作业完成情况")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "groupId",value ="小组id" ,required =true),
            @ApiImplicitParam(name = "groupCourseId",value = "课程id",required = true),
            @ApiImplicitParam(name = "pageSize", value = "每一页的数量(10)", required = false),
            @ApiImplicitParam(name = "pageNum", value = "当前页(1)", required = false)
    })
    public PageBean<AdminGroupHomework> queryGroupHomeWorkById(Integer groupId,Integer groupCourseId,Integer pageSize, Integer pageNum){
        return adminScoreService.queryAllGroupHomeworkInfoById(groupId,groupCourseId,pageSize,pageNum);

    }

    /**
     * 根据id查询小组某次作业的完成详情
     * @param homeworkId
     * @return
     */
    @GetMapping("/queryGroupHomeworkInfoById")
    @ApiOperation("根据id查询小组某次作业的完成详情")
    @ApiImplicitParam(name = "homeworkId",value = "作业id",required = true)
    public Page<AdminGroupHomework> queryGroupHomeworkInfoById(Integer homeworkId){
        return adminScoreService.queryGroupHomeworkInfoById(homeworkId);

    }


}
